package com.abaaba.project2.bean.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class WxOrderDetailInfoVo {
    private Short orderStatus;
    private String consignee;
    private String address;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date addTime;
    private String orderSn;
    private BigDecimal actualPrice;
    private String mobile;
    private String orderStatusText;
    private BigDecimal goodsPrice;
    private BigDecimal couponPrice;
    private Integer id;
    private BigDecimal freightPrice;
    private WxHandleOption handleOption;

    public void setOrderStatus(Short orderStatus) {
        this.orderStatus = orderStatus;
        if (orderStatus == 101) {
            this.setOrderStatusText("未付款");
            this.handleOption = new WxHandleOption();
            this.handleOption.setCancel(true);
            this.handleOption.setPay(true);
        } else if (orderStatus == 102) {
            this.setOrderStatusText("已取消");
            this.handleOption = new WxHandleOption();
            this.handleOption.setDelete(true);
        } else if (orderStatus == 103) {
            this.setOrderStatusText("已取消(系统)");
            this.handleOption = new WxHandleOption();
            this.handleOption.setDelete(true);
        } else if (orderStatus == 201) {
            this.setOrderStatusText("已付款");
            this.handleOption = new WxHandleOption();
            this.handleOption.setRefund(true);
        } else if (orderStatus == 202) {
            this.setOrderStatusText("申请退款");
            this.handleOption = new WxHandleOption();
        } else if (orderStatus == 203) {
            this.setOrderStatusText("订单取消,退款中");
            this.handleOption = new WxHandleOption();
        } else if (orderStatus == 301) {
            this.setOrderStatusText("已发货");
            this.handleOption = new WxHandleOption();
            this.handleOption.setConfirm(true);
        } else if (orderStatus == 401) {
            this.setOrderStatusText("已收货");
            this.handleOption = new WxHandleOption();
            this.handleOption.setDelete(true);
            this.handleOption.setComment(true);
            this.handleOption.setRebuy(true);
        } else if (orderStatus == 402) {
            this.setOrderStatusText("已收货(系统)");
            this.handleOption = new WxHandleOption();
            this.handleOption.setDelete(true);
            this.handleOption.setComment(true);
            this.handleOption.setRebuy(true);
        }else if (orderStatus == 403) {
            this.setOrderStatusText("已收货");//已评价
            this.handleOption = new WxHandleOption();
            this.handleOption.setDelete(true);
            this.handleOption.setComment(false);
            this.handleOption.setRebuy(true);
        }
    }

}
